<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Java复习（一） | 凌歆的博客</title>
    <meta name="generator" content="VuePress 1.9.5">
    <link rel="icon" href="/img/favicon.ico">
    <meta name="description" content="web前端技术博客,专注web前端学习与总结。JavaScript,js,ES6,TypeScript,vue,React,python,css3,html5,Node,git,github等技术文章。">
    <meta name="keywords" content="前端博客,个人技术博客,前端,前端开发,前端框架,web前端,前端面试题,技术文档,学习,面试,JavaScript,js,ES6,TypeScript,vue,python,css3,html5,Node,git,github,markdown">
    <meta name="baidu-site-verification" content="7F55weZDDc">
    <meta name="theme-color" content="#11a8cd">
    
    <link rel="preload" href="/assets/css/0.styles.d9c8cf8c.css" as="style"><link rel="preload" href="/assets/js/app.57550e13.js" as="script"><link rel="preload" href="/assets/js/2.f014c35f.js" as="script"><link rel="preload" href="/assets/js/83.e256d909.js" as="script"><link rel="prefetch" href="/assets/js/10.03a98811.js"><link rel="prefetch" href="/assets/js/100.145e708e.js"><link rel="prefetch" href="/assets/js/101.098ca5c8.js"><link rel="prefetch" href="/assets/js/102.4d45c69a.js"><link rel="prefetch" href="/assets/js/103.499de505.js"><link rel="prefetch" href="/assets/js/104.c2c1b9b6.js"><link rel="prefetch" href="/assets/js/105.4e9b0663.js"><link rel="prefetch" href="/assets/js/106.9bb8cf6f.js"><link rel="prefetch" href="/assets/js/107.a81b32d7.js"><link rel="prefetch" href="/assets/js/108.81511e67.js"><link rel="prefetch" href="/assets/js/109.6a6741bf.js"><link rel="prefetch" href="/assets/js/11.e8729182.js"><link rel="prefetch" href="/assets/js/110.de657fe7.js"><link rel="prefetch" href="/assets/js/111.b092af6d.js"><link rel="prefetch" href="/assets/js/112.2dca5709.js"><link rel="prefetch" href="/assets/js/113.dbed1fac.js"><link rel="prefetch" href="/assets/js/114.e95a0131.js"><link rel="prefetch" href="/assets/js/115.2e3e8285.js"><link rel="prefetch" href="/assets/js/116.e64f7fec.js"><link rel="prefetch" href="/assets/js/117.583552c9.js"><link rel="prefetch" href="/assets/js/118.aa5d18f0.js"><link rel="prefetch" href="/assets/js/119.0c7b52d7.js"><link rel="prefetch" href="/assets/js/12.d63acec2.js"><link rel="prefetch" href="/assets/js/120.13f86281.js"><link rel="prefetch" href="/assets/js/121.e2b5b7f9.js"><link rel="prefetch" href="/assets/js/122.5252216a.js"><link rel="prefetch" href="/assets/js/123.8b8a3503.js"><link rel="prefetch" href="/assets/js/124.60df855c.js"><link rel="prefetch" href="/assets/js/125.f073ab1c.js"><link rel="prefetch" href="/assets/js/126.7b73de6a.js"><link rel="prefetch" href="/assets/js/127.4e25971c.js"><link rel="prefetch" href="/assets/js/128.0edf0e06.js"><link rel="prefetch" href="/assets/js/129.5cb5a70a.js"><link rel="prefetch" href="/assets/js/13.2259ef71.js"><link rel="prefetch" href="/assets/js/130.00247fda.js"><link rel="prefetch" href="/assets/js/131.d6fc003a.js"><link rel="prefetch" href="/assets/js/132.1a32b18f.js"><link rel="prefetch" href="/assets/js/133.e46c0193.js"><link rel="prefetch" href="/assets/js/134.a6ad681f.js"><link rel="prefetch" href="/assets/js/135.2fcbe137.js"><link rel="prefetch" href="/assets/js/136.f69bf451.js"><link rel="prefetch" href="/assets/js/137.b9ef2fcc.js"><link rel="prefetch" href="/assets/js/138.7fdd9feb.js"><link rel="prefetch" href="/assets/js/139.a3a37c91.js"><link rel="prefetch" href="/assets/js/14.0d6b23b9.js"><link rel="prefetch" href="/assets/js/140.a7c013ae.js"><link rel="prefetch" href="/assets/js/141.956c36ce.js"><link rel="prefetch" href="/assets/js/142.5aacfe42.js"><link rel="prefetch" href="/assets/js/143.57d691ef.js"><link rel="prefetch" href="/assets/js/144.b1e5766e.js"><link rel="prefetch" href="/assets/js/145.463284b7.js"><link rel="prefetch" href="/assets/js/146.6cc6420c.js"><link rel="prefetch" href="/assets/js/147.5b78c5a2.js"><link rel="prefetch" href="/assets/js/148.8d1d7679.js"><link rel="prefetch" href="/assets/js/149.4e0eb213.js"><link rel="prefetch" href="/assets/js/15.f6fde69d.js"><link rel="prefetch" href="/assets/js/150.b183de37.js"><link rel="prefetch" href="/assets/js/151.729ae770.js"><link rel="prefetch" href="/assets/js/152.b1297018.js"><link rel="prefetch" href="/assets/js/153.bb991bca.js"><link rel="prefetch" href="/assets/js/154.6f2286aa.js"><link rel="prefetch" href="/assets/js/155.6a9c7e4d.js"><link rel="prefetch" href="/assets/js/156.f7bd535d.js"><link rel="prefetch" href="/assets/js/157.64c0065c.js"><link rel="prefetch" href="/assets/js/158.d31ae949.js"><link rel="prefetch" href="/assets/js/159.7daea8a7.js"><link rel="prefetch" href="/assets/js/16.7be21beb.js"><link rel="prefetch" href="/assets/js/160.33cc971a.js"><link rel="prefetch" href="/assets/js/161.1676442a.js"><link rel="prefetch" href="/assets/js/162.71378046.js"><link rel="prefetch" href="/assets/js/163.99e49959.js"><link rel="prefetch" href="/assets/js/164.306f07d2.js"><link rel="prefetch" href="/assets/js/165.170977c7.js"><link rel="prefetch" href="/assets/js/166.f8602525.js"><link rel="prefetch" href="/assets/js/167.eea5c001.js"><link rel="prefetch" href="/assets/js/168.0146a311.js"><link rel="prefetch" href="/assets/js/169.05f9c9d9.js"><link rel="prefetch" href="/assets/js/17.2543f471.js"><link rel="prefetch" href="/assets/js/170.25d602b2.js"><link rel="prefetch" href="/assets/js/171.1ada26a6.js"><link rel="prefetch" href="/assets/js/172.2a0f697c.js"><link rel="prefetch" href="/assets/js/173.230d8ca8.js"><link rel="prefetch" href="/assets/js/174.e3758a2b.js"><link rel="prefetch" href="/assets/js/175.0f19f8ea.js"><link rel="prefetch" href="/assets/js/176.bf70d37d.js"><link rel="prefetch" href="/assets/js/177.4400f272.js"><link rel="prefetch" href="/assets/js/178.85af7b89.js"><link rel="prefetch" href="/assets/js/179.4cfaaaa2.js"><link rel="prefetch" href="/assets/js/18.394415f8.js"><link rel="prefetch" href="/assets/js/180.449c8409.js"><link rel="prefetch" href="/assets/js/181.73276924.js"><link rel="prefetch" href="/assets/js/182.5fab25cc.js"><link rel="prefetch" href="/assets/js/183.ecd4934d.js"><link rel="prefetch" href="/assets/js/184.246092cf.js"><link rel="prefetch" href="/assets/js/185.c671cd86.js"><link rel="prefetch" href="/assets/js/186.49bd1963.js"><link rel="prefetch" href="/assets/js/187.1fb32764.js"><link rel="prefetch" href="/assets/js/188.7c6885e9.js"><link rel="prefetch" href="/assets/js/189.a8701dec.js"><link rel="prefetch" href="/assets/js/19.ca7db8ea.js"><link rel="prefetch" href="/assets/js/190.ae3d3bde.js"><link rel="prefetch" href="/assets/js/191.ad7cd44e.js"><link rel="prefetch" href="/assets/js/192.bc443842.js"><link rel="prefetch" href="/assets/js/193.e4755764.js"><link rel="prefetch" href="/assets/js/194.814112ce.js"><link rel="prefetch" href="/assets/js/195.1c0aaa80.js"><link rel="prefetch" href="/assets/js/196.a6bd7add.js"><link rel="prefetch" href="/assets/js/20.4e91cd31.js"><link rel="prefetch" href="/assets/js/21.f095e6e1.js"><link rel="prefetch" href="/assets/js/22.72f4b8ab.js"><link rel="prefetch" href="/assets/js/23.e94eb9d2.js"><link rel="prefetch" href="/assets/js/24.0eae7d6f.js"><link rel="prefetch" href="/assets/js/25.36157609.js"><link rel="prefetch" href="/assets/js/26.dc5b6cba.js"><link rel="prefetch" href="/assets/js/27.c19b7b63.js"><link rel="prefetch" href="/assets/js/28.3aceae59.js"><link rel="prefetch" href="/assets/js/29.536091b3.js"><link rel="prefetch" href="/assets/js/3.d11119c4.js"><link rel="prefetch" href="/assets/js/30.821a4a30.js"><link rel="prefetch" href="/assets/js/31.5238784c.js"><link rel="prefetch" href="/assets/js/32.10bc7179.js"><link rel="prefetch" href="/assets/js/33.c1ed69c9.js"><link rel="prefetch" href="/assets/js/34.8d384231.js"><link rel="prefetch" href="/assets/js/35.d8890e52.js"><link rel="prefetch" href="/assets/js/36.eca37ad5.js"><link rel="prefetch" href="/assets/js/37.802549e3.js"><link rel="prefetch" href="/assets/js/38.53841770.js"><link rel="prefetch" href="/assets/js/39.7ae44409.js"><link rel="prefetch" href="/assets/js/4.493b9bca.js"><link rel="prefetch" href="/assets/js/40.ce56364a.js"><link rel="prefetch" href="/assets/js/41.85f0114b.js"><link rel="prefetch" href="/assets/js/42.714da6e2.js"><link rel="prefetch" href="/assets/js/43.fee4437c.js"><link rel="prefetch" href="/assets/js/44.b039b68b.js"><link rel="prefetch" href="/assets/js/45.96a55605.js"><link rel="prefetch" href="/assets/js/46.956ffb03.js"><link rel="prefetch" href="/assets/js/47.147d9218.js"><link rel="prefetch" href="/assets/js/48.ff787b40.js"><link rel="prefetch" href="/assets/js/49.871eee87.js"><link rel="prefetch" href="/assets/js/5.e0ba07d7.js"><link rel="prefetch" href="/assets/js/50.99b7c29e.js"><link rel="prefetch" href="/assets/js/51.8ecbf4ba.js"><link rel="prefetch" href="/assets/js/52.53d91d7e.js"><link rel="prefetch" href="/assets/js/53.af8a0d2a.js"><link rel="prefetch" href="/assets/js/54.a2f848b5.js"><link rel="prefetch" href="/assets/js/55.267e9947.js"><link rel="prefetch" href="/assets/js/56.0b201c40.js"><link rel="prefetch" href="/assets/js/57.cbdfd6f7.js"><link rel="prefetch" href="/assets/js/58.636c0c3f.js"><link rel="prefetch" href="/assets/js/59.fc9216c4.js"><link rel="prefetch" href="/assets/js/6.b98373f2.js"><link rel="prefetch" href="/assets/js/60.34f16fc4.js"><link rel="prefetch" href="/assets/js/61.4d130bd8.js"><link rel="prefetch" href="/assets/js/62.927caa10.js"><link rel="prefetch" href="/assets/js/63.a451fee0.js"><link rel="prefetch" href="/assets/js/64.32a5d47b.js"><link rel="prefetch" href="/assets/js/65.bc099429.js"><link rel="prefetch" href="/assets/js/66.3953050d.js"><link rel="prefetch" href="/assets/js/67.e934823b.js"><link rel="prefetch" href="/assets/js/68.4bcb52b0.js"><link rel="prefetch" href="/assets/js/69.bede18c8.js"><link rel="prefetch" href="/assets/js/7.8de8df2d.js"><link rel="prefetch" href="/assets/js/70.fce1daac.js"><link rel="prefetch" href="/assets/js/71.ea0a8c5d.js"><link rel="prefetch" href="/assets/js/72.15382c9e.js"><link rel="prefetch" href="/assets/js/73.848364d3.js"><link rel="prefetch" href="/assets/js/74.5fd08a50.js"><link rel="prefetch" href="/assets/js/75.c937c70d.js"><link rel="prefetch" href="/assets/js/76.a0dacd5a.js"><link rel="prefetch" href="/assets/js/77.4019cc23.js"><link rel="prefetch" href="/assets/js/78.9676a9e1.js"><link rel="prefetch" href="/assets/js/79.e46e10d5.js"><link rel="prefetch" href="/assets/js/8.2098eb96.js"><link rel="prefetch" href="/assets/js/80.987e83cb.js"><link rel="prefetch" href="/assets/js/81.eb98ff36.js"><link rel="prefetch" href="/assets/js/82.623561a7.js"><link rel="prefetch" href="/assets/js/84.7d06a550.js"><link rel="prefetch" href="/assets/js/85.b8d9879e.js"><link rel="prefetch" href="/assets/js/86.31c4581b.js"><link rel="prefetch" href="/assets/js/87.e06ee05e.js"><link rel="prefetch" href="/assets/js/88.81ef718d.js"><link rel="prefetch" href="/assets/js/89.ba237d2f.js"><link rel="prefetch" href="/assets/js/9.36092fd0.js"><link rel="prefetch" href="/assets/js/90.ad2c9d92.js"><link rel="prefetch" href="/assets/js/91.a661f52d.js"><link rel="prefetch" href="/assets/js/92.1c28035b.js"><link rel="prefetch" href="/assets/js/93.c8b8e3d6.js"><link rel="prefetch" href="/assets/js/94.b6bc4a44.js"><link rel="prefetch" href="/assets/js/95.92cea882.js"><link rel="prefetch" href="/assets/js/96.5373491b.js"><link rel="prefetch" href="/assets/js/97.bb39efc8.js"><link rel="prefetch" href="/assets/js/98.af7a030f.js"><link rel="prefetch" href="/assets/js/99.07dc87d8.js">
    <link rel="stylesheet" href="/assets/css/0.styles.d9c8cf8c.css">
  </head>
  <body class="theme-mode-light">
    <div id="app" data-server-rendered="true"><div class="theme-container sidebar-open have-rightmenu"><header class="navbar blur"><div title="目录" class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="https://lingxin-tanhua.oss-cn-shanghai.aliyuncs.com/QQ%E6%88%AA%E5%9B%BE20220503092755.png" alt="凌歆的博客" class="logo"> <span class="site-name can-hide">凌歆的博客</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link">首页</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="前端" class="dropdown-title"><a href="/web/" class="link-title">前端</a> <span class="title" style="display:none;">前端</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>学习笔记</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/note/html/" class="nav-link">HTML笔记</a></li><li class="dropdown-subitem"><a href="/note/js-low/" class="nav-link">JavaScript基础笔记</a></li><li class="dropdown-subitem"><a href="/note/js-high/" class="nav-link">JavaScript高阶笔记</a></li><li class="dropdown-subitem"><a href="/note/js-dom-bom/" class="nav-link">JavaScript DOM和BOM笔记</a></li><li class="dropdown-subitem"><a href="/note/jquery/" class="nav-link">jQuery笔记</a></li><li class="dropdown-subitem"><a href="/note/ajax/" class="nav-link">Ajax笔记</a></li><li class="dropdown-subitem"><a href="/note/nodejs/" class="nav-link">NodeJs笔记</a></li><li class="dropdown-subitem"><a href="/note/reg/" class="nav-link">正则表达式笔记</a></li><li class="dropdown-subitem"><a href="/note/vue/" class="nav-link">Vue笔记</a></li><li class="dropdown-subitem"><a href="/note/react/" class="nav-link">react笔记</a></li><li class="dropdown-subitem"><a href="/note/wx/" class="nav-link">微信小程序笔记</a></li><li class="dropdown-subitem"><a href="/note/uniapp/" class="nav-link">uniapp笔记</a></li><li class="dropdown-subitem"><a href="/note/echarts/" class="nav-link">echarts笔记</a></li><li class="dropdown-subitem"><a href="/note/git/" class="nav-link">Git笔记</a></li></ul></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="后端" class="dropdown-title"><a href="/back/" class="link-title">后端</a> <span class="title" style="display:none;">后端</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/note/java/" class="nav-link">JAVA</a></li><li class="dropdown-item"><!----> <a href="/note/javaweb/" class="nav-link">JavaWeb</a></li><li class="dropdown-item"><!----> <a href="/note/mysql/" class="nav-link">MySql</a></li><li class="dropdown-item"><!----> <a href="/note/ssm/" class="nav-link">ssm</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="算法" class="dropdown-title"><a href="/algor/" class="link-title">算法</a> <span class="title" style="display:none;">算法</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/note/sf/" class="nav-link">算法训练营</a></li><li class="dropdown-item"><!----> <a href="/note/js-sf/" class="nav-link">js数据结构与算法</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="面试" class="dropdown-title"><a href="/mianshi/" class="link-title">面试</a> <span class="title" style="display:none;">面试</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/note/lqb/" class="nav-link">蓝桥杯备战</a></li><li class="dropdown-item"><!----> <a href="/note/ms/" class="nav-link">前端面试</a></li><li class="dropdown-item"><!----> <a href="/note/hmms/" class="nav-link">黑马面试</a></li><li class="dropdown-item"><!----> <a href="/note/xzms/" class="nav-link">校招零距离面试</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="解决方案" class="dropdown-title"><a href="/resolve/" class="link-title">解决方案</a> <span class="title" style="display:none;">解决方案</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/note/qd-resolve/" class="nav-link">前端解决方案</a></li><li class="dropdown-item"><!----> <a href="/note/hd-resolve/" class="nav-link">后端解决方案</a></li></ul></div></div><div class="nav-item"><a href="/pages/beb6c0bd8a66cea6/" class="nav-link">收藏</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="索引" class="dropdown-title"><a href="/archives/" class="link-title">索引</a> <span class="title" style="display:none;">索引</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/" class="nav-link">分类</a></li><li class="dropdown-item"><!----> <a href="/tags/" class="nav-link">标签</a></li><li class="dropdown-item"><!----> <a href="/archives/" class="nav-link">归档</a></li></ul></div></div> <a href="https://github.com/linxin1123/vuepress-blog" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <div class="sidebar-hover-trigger"></div> <aside class="sidebar" style="display:none;"><div class="blogger"><img src="https://lingxin-tanhua.oss-cn-shanghai.aliyuncs.com/QQ%E6%88%AA%E5%9B%BE20220503092755.png"> <div class="blogger-info"><h3>lingxin</h3> <span>凌歆</span></div></div> <nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link">首页</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="前端" class="dropdown-title"><a href="/web/" class="link-title">前端</a> <span class="title" style="display:none;">前端</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>学习笔记</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/note/html/" class="nav-link">HTML笔记</a></li><li class="dropdown-subitem"><a href="/note/js-low/" class="nav-link">JavaScript基础笔记</a></li><li class="dropdown-subitem"><a href="/note/js-high/" class="nav-link">JavaScript高阶笔记</a></li><li class="dropdown-subitem"><a href="/note/js-dom-bom/" class="nav-link">JavaScript DOM和BOM笔记</a></li><li class="dropdown-subitem"><a href="/note/jquery/" class="nav-link">jQuery笔记</a></li><li class="dropdown-subitem"><a href="/note/ajax/" class="nav-link">Ajax笔记</a></li><li class="dropdown-subitem"><a href="/note/nodejs/" class="nav-link">NodeJs笔记</a></li><li class="dropdown-subitem"><a href="/note/reg/" class="nav-link">正则表达式笔记</a></li><li class="dropdown-subitem"><a href="/note/vue/" class="nav-link">Vue笔记</a></li><li class="dropdown-subitem"><a href="/note/react/" class="nav-link">react笔记</a></li><li class="dropdown-subitem"><a href="/note/wx/" class="nav-link">微信小程序笔记</a></li><li class="dropdown-subitem"><a href="/note/uniapp/" class="nav-link">uniapp笔记</a></li><li class="dropdown-subitem"><a href="/note/echarts/" class="nav-link">echarts笔记</a></li><li class="dropdown-subitem"><a href="/note/git/" class="nav-link">Git笔记</a></li></ul></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="后端" class="dropdown-title"><a href="/back/" class="link-title">后端</a> <span class="title" style="display:none;">后端</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/note/java/" class="nav-link">JAVA</a></li><li class="dropdown-item"><!----> <a href="/note/javaweb/" class="nav-link">JavaWeb</a></li><li class="dropdown-item"><!----> <a href="/note/mysql/" class="nav-link">MySql</a></li><li class="dropdown-item"><!----> <a href="/note/ssm/" class="nav-link">ssm</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="算法" class="dropdown-title"><a href="/algor/" class="link-title">算法</a> <span class="title" style="display:none;">算法</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/note/sf/" class="nav-link">算法训练营</a></li><li class="dropdown-item"><!----> <a href="/note/js-sf/" class="nav-link">js数据结构与算法</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="面试" class="dropdown-title"><a href="/mianshi/" class="link-title">面试</a> <span class="title" style="display:none;">面试</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/note/lqb/" class="nav-link">蓝桥杯备战</a></li><li class="dropdown-item"><!----> <a href="/note/ms/" class="nav-link">前端面试</a></li><li class="dropdown-item"><!----> <a href="/note/hmms/" class="nav-link">黑马面试</a></li><li class="dropdown-item"><!----> <a href="/note/xzms/" class="nav-link">校招零距离面试</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="解决方案" class="dropdown-title"><a href="/resolve/" class="link-title">解决方案</a> <span class="title" style="display:none;">解决方案</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/note/qd-resolve/" class="nav-link">前端解决方案</a></li><li class="dropdown-item"><!----> <a href="/note/hd-resolve/" class="nav-link">后端解决方案</a></li></ul></div></div><div class="nav-item"><a href="/pages/beb6c0bd8a66cea6/" class="nav-link">收藏</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="索引" class="dropdown-title"><a href="/archives/" class="link-title">索引</a> <span class="title" style="display:none;">索引</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/" class="nav-link">分类</a></li><li class="dropdown-item"><!----> <a href="/tags/" class="nav-link">标签</a></li><li class="dropdown-item"><!----> <a href="/archives/" class="nav-link">归档</a></li></ul></div></div> <a href="https://github.com/linxin1123/vuepress-blog" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav>  <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>学习笔记</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>Java笔记</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/pages/ee64d9/" aria-current="page" class="active sidebar-link">Java复习（一）</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level2"><a href="/pages/ee64d9/#_1-java技术体系" class="sidebar-link">1. java技术体系</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_1-1-jre和jdk-记忆" class="sidebar-link">1.1 JRE和JDK（记忆）</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/ee64d9/#_2-idea-快捷键" class="sidebar-link">2.idea 快捷键</a></li><li class="sidebar-sub-header level2"><a href="/pages/ee64d9/#_3-变量" class="sidebar-link">3. 变量</a></li><li class="sidebar-sub-header level2"><a href="/pages/ee64d9/#_4-数据类型" class="sidebar-link">4. 数据类型</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_4-1-数据类型的自动转换" class="sidebar-link">4.1 数据类型的自动转换</a></li><li class="sidebar-sub-header level4"><a href="/pages/ee64d9/#注意点" class="sidebar-link">注意点</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/ee64d9/#_5-类名命名规范" class="sidebar-link">5.类名命名规范</a></li><li class="sidebar-sub-header level2"><a href="/pages/ee64d9/#_6-java中的内存分配-红色-栈-蓝色-堆" class="sidebar-link">6. java中的内存分配（红色-栈，蓝色-堆）</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_6-1-堆内存new出来的实体默认值" class="sidebar-link">6.1 堆内存new出来的实体默认值</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/ee64d9/#_7-方法重载和方法重写" class="sidebar-link">7.方法重载和方法重写</a></li><li class="sidebar-sub-header level2"><a href="/pages/ee64d9/#_8-类和对象" class="sidebar-link">8.类和对象</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_8-1-类" class="sidebar-link">8.1 类</a></li><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_8-2-对象" class="sidebar-link">8.2 对象</a></li><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_8-3-对象内存图" class="sidebar-link">8.3 对象内存图</a></li><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_8-4-成员变量和局部变量" class="sidebar-link">8.4 成员变量和局部变量</a></li><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_8-5-private-关键字" class="sidebar-link">8.5 private 关键字</a></li><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_8-6-this-关键字" class="sidebar-link">8.6 this 关键字</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/ee64d9/#_9-数组" class="sidebar-link">9.数组</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_9-1-数组的创建" class="sidebar-link">9.1 数组的创建</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/ee64d9/#_10-方法" class="sidebar-link">10.方法</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_10-1-方法的创建-一个类的外面" class="sidebar-link">10.1 方法的创建（一个类的外面）</a></li><li class="sidebar-sub-header level4"><a href="/pages/ee64d9/#方法调用的内存图" class="sidebar-link">方法调用的内存图</a></li><li class="sidebar-sub-header level4"><a href="/pages/ee64d9/#注意点-2" class="sidebar-link">注意点</a></li><li class="sidebar-sub-header level4"><a href="/pages/ee64d9/#基本数据类型传参-不影响原来的参数" class="sidebar-link">基本数据类型传参，不影响原来的参数</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/ee64d9/#_11-arraylist-类" class="sidebar-link">11. ArrayList 类</a></li><li class="sidebar-sub-header level2"><a href="/pages/ee64d9/#_12-string" class="sidebar-link">12. String</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_12-1-string对象的特点" class="sidebar-link">12.1 String对象的特点</a></li><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_12-2-string-内存图" class="sidebar-link">12.2 String 内存图</a></li><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_12-3-字符串拼接的后果" class="sidebar-link">12.3 字符串拼接的后果</a></li><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_12-4-stringbuilder-类" class="sidebar-link">12.4 StringBuilder 类</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/ee64d9/#_13-继承" class="sidebar-link">13. 继承</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_13-1-作用域链" class="sidebar-link">13.1 作用域链</a></li><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_13-2-super关键字" class="sidebar-link">13.2 super关键字</a></li><li class="sidebar-sub-header level4"><a href="/pages/ee64d9/#super-内存图" class="sidebar-link">super 内存图</a></li><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_13-3-继承中子类构造方法的特点" class="sidebar-link">13.3 继承中子类构造方法的特点</a></li><li class="sidebar-sub-header level3"><a href="/pages/ee64d9/#_13-4-方法重写" class="sidebar-link">13.4 方法重写</a></li><li class="sidebar-sub-header level4"><a href="/pages/ee64d9/#重写父类-comparable接口-的排序方法" class="sidebar-link">重写父类（Comparable接口）的排序方法</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/ee64d9/#_14-final-关键字" class="sidebar-link">14. final 关键字</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level4"><a href="/pages/ee64d9/#注意点-3" class="sidebar-link">注意点</a></li><li class="sidebar-sub-header level4"><a href="/pages/ee64d9/#final-修饰局部变量" class="sidebar-link">final 修饰局部变量</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/ee64d9/#_15-static-关键字" class="sidebar-link">15. static 关键字</a></li></ul></li><li><a href="/pages/659fa7/" class="sidebar-link">Java复习（二）</a></li><li><a href="/pages/c57687/" class="sidebar-link">Java io流（一）</a></li><li><a href="/pages/8ac044/" class="sidebar-link">Java io流（二）</a></li><li><a href="/pages/2d0d17/" class="sidebar-link">Java io流（三）</a></li><li><a href="/pages/e16a86/" class="sidebar-link">java-网络编程</a></li><li><a href="/pages/d7d5c4/" class="sidebar-link">Java 反射和注解</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>JavaWeb笔记</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>MySql笔记</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>SSM笔记</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <div><main class="page"><div class="theme-vdoing-wrapper "><div class="articleInfo-wrap" data-v-06225672><div class="articleInfo" data-v-06225672><ul class="breadcrumbs" data-v-06225672><li data-v-06225672><a href="/" title="首页" class="iconfont icon-home router-link-active" data-v-06225672></a></li> <li data-v-06225672><a href="/back/#后端" data-v-06225672>后端</a></li><li data-v-06225672><a href="/back/#Java笔记" data-v-06225672>Java笔记</a></li></ul> <div class="info" data-v-06225672><div title="作者" class="author iconfont icon-touxiang" data-v-06225672><a href="https://github.com/linxin1123" target="_blank" title="作者" class="beLink" data-v-06225672>lingxin</a></div> <div title="创建时间" class="date iconfont icon-riqi" data-v-06225672><a href="javascript:;" data-v-06225672>2023-01-25</a></div> <!----></div></div></div> <!----> <div class="content-wrapper"><div class="right-menu-wrapper"><div class="right-menu-margin"><div class="right-menu-title">目录</div> <div class="right-menu-content"></div></div></div> <h1><img src="">Java复习（一）<!----></h1>  <div class="theme-vdoing-content content__default"><h1 id="java复习"><a href="#java复习" class="header-anchor">#</a> java复习</h1> <p><img src="https://img-blog.csdnimg.cn/39ca9d2209e941e8958c4f5516c4b0de.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <p>@<a href="%E7%9B%AE%E5%BD%95">toc</a></p> <h2 id="_1-java技术体系"><a href="#_1-java技术体系" class="header-anchor">#</a> 1. java技术体系</h2> <table><thead><tr><th>技术体系</th> <th>说明</th></tr></thead> <tbody><tr><td>javaSE:标准版</td> <td>java技术的核心和基础</td></tr> <tr><td>javaEE：企业版</td> <td>企业级应用开发的一套解决方案</td></tr> <tr><td>javaME：小型版</td> <td>针对移动设备应用的解决方案</td></tr></tbody></table> <h3 id="_1-1-jre和jdk-记忆"><a href="#_1-1-jre和jdk-记忆" class="header-anchor">#</a> 1.1 JRE和JDK（记忆）</h3> <table><thead><tr><th>缩写</th> <th>说明</th></tr></thead> <tbody><tr><td>JVM（virtual box）</td> <td>java 虚拟机</td></tr> <tr><td>JRE（Runtime Environment）</td> <td>java运行环境</td></tr> <tr><td>JDK(Development Kit)</td> <td>包含JRE和开发工具</td></tr></tbody></table> <h2 id="_2-idea-快捷键"><a href="#_2-idea-快捷键" class="header-anchor">#</a> 2.idea 快捷键</h2> <table><thead><tr><th>快捷键</th> <th>功能效果</th></tr></thead> <tbody><tr><td>main/psvm,sout</td> <td>快速输入相关代码</td></tr> <tr><td>ctrl+alt+L</td> <td>格式化代码</td></tr> <tr><td>alt+shift+↑</td> <td>上移当前代码</td></tr> <tr><td>alt+shift+↓</td> <td>下移当前代码</td></tr> <tr><td>alt+insert</td> <td>在类中快速生成构造方法，get，set方法</td></tr> <tr><td>ctrl+alt+v</td> <td>补全左边的返回值</td></tr> <tr><td>shift+enter</td> <td>切换下一行</td></tr></tbody></table> <h2 id="_3-变量"><a href="#_3-变量" class="header-anchor">#</a> 3. 变量</h2> <ul><li><strong>变量定义时可以没有初始化值，但在使用时必须有初始值</strong></li></ul> <h2 id="_4-数据类型"><a href="#_4-数据类型" class="header-anchor">#</a> 4. 数据类型</h2> <ul><li>整数
<ul><li>byte：1字节</li> <li>short：2字节</li> <li>int（默认）：4字节</li> <li>long，<strong>后面加L/l代表long类型</strong>：8字节</li></ul></li> <li>浮点数
<ul><li>float，<strong>后面加f/F</strong>：4 字节</li> <li>double（默认）：8字节</li></ul></li> <li>字符
<ul><li>char：2字节</li></ul></li> <li>布尔
<ul><li>boolean：1字节</li></ul></li></ul> <h3 id="_4-1-数据类型的自动转换"><a href="#_4-1-数据类型的自动转换" class="header-anchor">#</a> 4.1 数据类型的自动转换</h3> <p><img src="https://img-blog.csdnimg.cn/0ff4d0e129d24af3a9c47b32b3cfd594.png#pic_center" alt="在这里插入图片描述"></p> <h4 id="注意点"><a href="#注意点" class="header-anchor">#</a> 注意点</h4> <ul><li><strong>boolean不参与自动类型转换</strong></li></ul> <h2 id="_5-类名命名规范"><a href="#_5-类名命名规范" class="header-anchor">#</a> 5.类名命名规范</h2> <ul><li><strong>首字母都大写</strong></li></ul> <h2 id="_6-java中的内存分配-红色-栈-蓝色-堆"><a href="#_6-java中的内存分配-红色-栈-蓝色-堆" class="header-anchor">#</a> 6. java中的内存分配（红色-栈，蓝色-堆）</h2> <ul><li>栈和堆</li> <li><strong>简单数据类型在栈</strong></li> <li><strong>复杂（引用数据类型）在堆</strong></li></ul> <p><img src="https://img-blog.csdnimg.cn/c06c67be4b0648cdb989cb8804fb5c1c.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <h3 id="_6-1-堆内存new出来的实体默认值"><a href="#_6-1-堆内存new出来的实体默认值" class="header-anchor">#</a> 6.1 堆内存new出来的实体默认值</h3> <table><thead><tr><th>数据类型</th> <th>默认值</th></tr></thead> <tbody><tr><td>整数</td> <td>0</td></tr> <tr><td>浮点数</td> <td>0.0</td></tr> <tr><td>布尔</td> <td>false</td></tr> <tr><td>字符</td> <td>空字符</td></tr> <tr><td>引用数据类型</td> <td>null</td></tr></tbody></table> <p><img src="https://img-blog.csdnimg.cn/a6b8c3fbfb8e46e6866864402080be17.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <p><img src="https://img-blog.csdnimg.cn/2774acf0875c401086fe722e32ead15c.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <h2 id="_7-方法重载和方法重写"><a href="#_7-方法重载和方法重写" class="header-anchor">#</a> 7.方法重载和方法重写</h2> <p><img src="https://img-blog.csdnimg.cn/de49cbdc54284b63ba9cbf01823e59cd.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <h2 id="_8-类和对象"><a href="#_8-类和对象" class="header-anchor">#</a> 8.类和对象</h2> <h3 id="_8-1-类"><a href="#_8-1-类" class="header-anchor">#</a> 8.1 类</h3> <ul><li><strong>定义：类是对现实生活中的一类具有共同属性和行为的事物的抽象</strong></li> <li><strong>组成：属性和行为（对应成员变量和成员方法）</strong></li></ul> <h3 id="_8-2-对象"><a href="#_8-2-对象" class="header-anchor">#</a> 8.2 对象</h3> <ul><li><strong>具体存在的事物</strong></li></ul> <h3 id="_8-3-对象内存图"><a href="#_8-3-对象内存图" class="header-anchor">#</a> 8.3 对象内存图</h3> <ul><li><strong>单个对象内存图</strong></li></ul> <p><img src="https://img-blog.csdnimg.cn/4f6f08691a6c4f98b5d5512978270085.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <p><img src="https://img-blog.csdnimg.cn/e76c6c096315441eb3d62e0877d19a6b.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <ul><li><strong>多个对象内存图</strong></li></ul> <p><img src="https://img-blog.csdnimg.cn/38499a2d7f3746a09f65dd7fb5039d31.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <p><img src="https://img-blog.csdnimg.cn/b4fdaee07cdb41f9993906987069606a.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <p><img src="https://img-blog.csdnimg.cn/1dd51e4bb77249d6a9e8faf80c719ac4.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <h3 id="_8-4-成员变量和局部变量"><a href="#_8-4-成员变量和局部变量" class="header-anchor">#</a> 8.4 成员变量和局部变量</h3> <ul><li><strong>成员变量：类中方法外</strong></li> <li><strong>局部变量：类中方法中或者形参</strong></li></ul> <h3 id="_8-5-private-关键字"><a href="#_8-5-private-关键字" class="header-anchor">#</a> 8.5 private 关键字</h3> <p><img src="https://img-blog.csdnimg.cn/32bbe3271fd34022b3bb0b003b5c504c.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <h3 id="_8-6-this-关键字"><a href="#_8-6-this-关键字" class="header-anchor">#</a> 8.6 this 关键字</h3> <ul><li><strong>this代表当前调用方法的引用，哪个对象调用方法，this指向哪个对象</strong></li> <li>图解</li></ul> <p><img src="https://img-blog.csdnimg.cn/1c91b723b25f45c593df02bd803d87a4.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <h2 id="_9-数组"><a href="#_9-数组" class="header-anchor">#</a> 9.数组</h2> <ul><li>存放数据长度固定的容器，<strong>存放的数据类型一致</strong></li></ul> <h3 id="_9-1-数组的创建"><a href="#_9-1-数组的创建" class="header-anchor">#</a> 9.1 数组的创建</h3> <ul><li>字面量</li></ul> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token keyword">int</span> <span class="token punctuation">[</span><span class="token punctuation">]</span>arr<span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ul><li>new 数据类型[数组长度]</li></ul> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token keyword">int</span> <span class="token punctuation">[</span><span class="token punctuation">]</span>arr<span class="token operator">=</span><span class="token keyword">new</span> <span class="token keyword">int</span><span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ul><li>new 数据类型[数组长度]  完整版</li></ul> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token keyword">int</span> <span class="token punctuation">[</span><span class="token punctuation">]</span>arr<span class="token operator">=</span><span class="token keyword">new</span> <span class="token keyword">int</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">{</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h2 id="_10-方法"><a href="#_10-方法" class="header-anchor">#</a> 10.方法</h2> <ul><li><strong>具有独立功能的一段代码的整体</strong></li> <li><strong>可以认为是函数</strong></li> <li><strong>在类中称为成员方法</strong></li></ul> <h3 id="_10-1-方法的创建-一个类的外面"><a href="#_10-1-方法的创建-一个类的外面" class="header-anchor">#</a> 10.1 方法的创建（一个类的外面）</h3> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token keyword">public</span> <span class="token keyword">static</span> 返回值类型 方法名<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span><span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ul><li>调用</li></ul> <div class="language-java line-numbers-mode"><pre class="language-java"><code>方法名（）<span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h4 id="方法调用的内存图"><a href="#方法调用的内存图" class="header-anchor">#</a> 方法调用的内存图</h4> <p><img src="https://img-blog.csdnimg.cn/28b9eff2e5464b428af62a5062ee54ad.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <h4 id="注意点-2"><a href="#注意点-2" class="header-anchor">#</a> 注意点</h4> <ul><li><strong>方法不能嵌套（一个方法里面里面在定义另一个方法）</strong></li></ul> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">method1</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> method2<span class="token punctuation">{</span>
        <span class="token comment">//这里编译错误</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h4 id="基本数据类型传参-不影响原来的参数"><a href="#基本数据类型传参-不影响原来的参数" class="header-anchor">#</a> 基本数据类型传参，不影响原来的参数</h4> <p><img src="https://img-blog.csdnimg.cn/ce7e720fe5364bd787231b6cba7a3101.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <p>####<strong>复杂（引用数据类型传参，影响原来的参数）</strong></p> <p><img src="https://img-blog.csdnimg.cn/eabc2ab30fa742478e32ef70ffc7cdd2.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <h2 id="_11-arraylist-类"><a href="#_11-arraylist-类" class="header-anchor">#</a> 11. ArrayList 类</h2> <ul><li>查jdk文档</li></ul> <h2 id="_12-string"><a href="#_12-string" class="header-anchor">#</a> 12. String</h2> <h3 id="_12-1-string对象的特点"><a href="#_12-1-string对象的特点" class="header-anchor">#</a> 12.1 String对象的特点</h3> <ul><li><strong>长度不可变</strong></li> <li><strong>new 出来的字符串地址引用不同</strong></li> <li><strong>以&quot;&quot;创建的字符串如果内容相同，则引用（地址）相同</strong></li></ul> <h3 id="_12-2-string-内存图"><a href="#_12-2-string-内存图" class="header-anchor">#</a> 12.2 String 内存图</h3> <p><img src="https://img-blog.csdnimg.cn/2c8069c0dc4f471298d90c0c8363d47c.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <h3 id="_12-3-字符串拼接的后果"><a href="#_12-3-字符串拼接的后果" class="header-anchor">#</a> 12.3 字符串拼接的后果</h3> <ul><li>图解</li></ul> <p><img src="https://img-blog.csdnimg.cn/7094ded4734943079e827d967d30690c.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <h3 id="_12-4-stringbuilder-类"><a href="#_12-4-stringbuilder-类" class="header-anchor">#</a> 12.4 StringBuilder 类</h3> <ul><li><p><strong>解决字符串拼接造成的资源浪费</strong></p></li> <li><p>使用方法：查阅jdk文档</p></li></ul> <h2 id="_13-继承"><a href="#_13-继承" class="header-anchor">#</a> 13. 继承</h2> <h3 id="_13-1-作用域链"><a href="#_13-1-作用域链" class="header-anchor">#</a> 13.1 作用域链</h3> <ul><li>查找一个变量，就近原则</li> <li><strong>就近原则：子类局部范围-&gt;子类成员范围-&gt;父类成员范围-&gt;报错</strong></li></ul> <h3 id="_13-2-super关键字"><a href="#_13-2-super关键字" class="header-anchor">#</a> 13.2 super关键字</h3> <ul><li><strong>父类对象引用</strong></li> <li><strong>this对象的父类（基类为object）</strong></li></ul> <h4 id="super-内存图"><a href="#super-内存图" class="header-anchor">#</a> super 内存图</h4> <p><img src="https://img-blog.csdnimg.cn/840cae314aa4443ab39f40958719eade.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5YeM5q2G,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p> <h3 id="_13-3-继承中子类构造方法的特点"><a href="#_13-3-继承中子类构造方法的特点" class="header-anchor">#</a> 13.3 继承中子类构造方法的特点</h3> <ul><li><p><strong>子类中所有的构造方法默认访问父类的无参构造</strong></p></li> <li><p><strong>子类的构造方法中第一句默认为super()，我们不可见，但它存在</strong></p></li> <li><p><strong>父类尽量都有无参构造方法，否则出错</strong></p></li></ul> <h3 id="_13-4-方法重写"><a href="#_13-4-方法重写" class="header-anchor">#</a> 13.4 方法重写</h3> <ul><li><strong>产生于继承中</strong></li> <li><strong>子类有父类的方法（结构完全一致）</strong></li> <li><strong>子类要重写父类方法</strong></li> <li><strong>父类的private 修饰的方法不能被重写</strong></li> <li><strong>使用Override 注解检测 重写方法</strong></li></ul> <h4 id="重写父类-comparable接口-的排序方法"><a href="#重写父类-comparable接口-的排序方法" class="header-anchor">#</a> 重写父类（Comparable接口）的排序方法</h4> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token annotation punctuation">@Override</span>
    <span class="token keyword">public</span> <span class="token keyword">int</span> <span class="token function">compareTo</span><span class="token punctuation">(</span><span class="token class-name">Student</span> o<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span>age<span class="token operator">-</span>o<span class="token punctuation">.</span>age<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><h2 id="_14-final-关键字"><a href="#_14-final-关键字" class="header-anchor">#</a> 14. final 关键字</h2> <ul><li>可修饰的东西
<ul><li><strong>成员变量</strong></li> <li><strong>成员方法</strong></li> <li><strong>类</strong></li> <li><strong>局部变量</strong></li></ul></li></ul> <h4 id="注意点-3"><a href="#注意点-3" class="header-anchor">#</a> 注意点</h4> <ul><li>被<strong>final修饰的类不可被继承（没有儿子，但可以有父亲）</strong></li> <li><strong>final修饰的成员变量为常量，不可被多次赋值</strong></li> <li><strong>final修饰的成员方法，不可被重写</strong></li></ul> <h4 id="final-修饰局部变量"><a href="#final-修饰局部变量" class="header-anchor">#</a> final 修饰局部变量</h4> <ul><li>修饰<strong>基本数据类型：值不可变</strong></li> <li>修饰<strong>引用数据类型：地址（引用不可变），堆内存的内容可以改变</strong></li></ul> <h2 id="_15-static-关键字"><a href="#_15-static-关键字" class="header-anchor">#</a> 15. static 关键字</h2> <ul><li>修饰<strong>成员变量，成员方法</strong></li> <li><strong>静态方法只可以访问静态变量</strong></li> <li><strong>被static修饰的方法，可以通过类名.方法调用（不需要实例化）</strong></li></ul></div></div>  <div class="page-edit"><div class="edit-link"><a href="https://github.com/linxin1123/vuepress-blog/edit/master/docs/02.后端/41.Java笔记/01.Java复习（一）.md" target="_blank" rel="noopener noreferrer">编辑</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></div> <!----> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2023/02/17, 11:29:32</span></div></div> <div class="page-nav-wapper"><div class="page-nav-centre-wrap"><a href="/note/ssm/" class="page-nav-centre page-nav-centre-prev"><div class="tooltip">SSM笔记</div></a> <a href="/pages/659fa7/" class="page-nav-centre page-nav-centre-next"><div class="tooltip">Java复习（二）</div></a></div> <div class="page-nav"><p class="inner"><span class="prev">
        ←
        <a href="/note/ssm/" class="prev">SSM笔记</a></span> <span class="next"><a href="/pages/659fa7/">Java复习（二）</a>→
      </span></p></div></div></div> <div class="article-list"><div class="article-title"><a href="/archives/" class="iconfont icon-bi">最近更新</a></div> <div class="article-wrapper"><dl><dd>01</dd> <dt><a href="/pages/0b785d/"><div>
            Vuex
            <!----></div></a> <span class="date">03-14</span></dt></dl><dl><dd>02</dd> <dt><a href="/pages/c59cc0/"><div>
            Vue响应式原理
            <!----></div></a> <span class="date">03-14</span></dt></dl><dl><dd>03</dd> <dt><a href="/pages/83cc7a/"><div>
            Vue虚拟DOM-cnblog
            <!----></div></a> <span class="date">03-14</span></dt></dl> <dl><dd></dd> <dt><a href="/archives/" class="more">更多文章&gt;</a></dt></dl></div></div></main></div> <div class="footer"><div class="icons"><a href="3010733382@qq.com" title="发邮件" target="_blank" class="iconfont icon-youjian"></a><a href="https://github.com/linxin1123" title="GitHub" target="_blank" class="iconfont icon-github"></a><a href="https://music.163.com/#/playlist?id=755597173" title="听音乐" target="_blank" class="iconfont icon-erji"></a></div> 
  Theme by
  <a href="https://github.com/xugaoyi/vuepress-theme-vdoing" target="_blank" title="本站主题">Vdoing</a> 
    | Copyright © 2022-2023
    <span>lingxin | <a href="https://github.com/linxin1123/vuepress-blog/blob/master/LICENSE" target="_blank">MIT License</a></span></div> <div class="buttons"><div title="返回顶部" class="button blur go-to-top iconfont icon-fanhuidingbu" style="display:none;"></div> <div title="去评论" class="button blur go-to-comment iconfont icon-pinglun" style="display:none;"></div> <div title="主题模式" class="button blur theme-mode-but iconfont icon-zhuti"><ul class="select-box" style="display:none;"><li class="iconfont icon-zidong">
          跟随系统
        </li><li class="iconfont icon-rijianmoshi">
          浅色模式
        </li><li class="iconfont icon-yejianmoshi">
          深色模式
        </li><li class="iconfont icon-yuedu">
          阅读模式
        </li></ul></div></div> <!----> <!----> <!----></div><div class="global-ui"><div></div></div></div>
    <script src="/assets/js/app.57550e13.js" defer></script><script src="/assets/js/2.f014c35f.js" defer></script><script src="/assets/js/83.e256d909.js" defer></script>
  </body>
</html>
